package com.stu.serive.impl;

import com.stu.Dto.StuPasswordDto;
import com.stu.mapper.StuPasswordMapper;
import com.stu.serive.StuPasswordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class StuPasswordServiceImpl implements StuPasswordService {

    @Autowired
    private StuPasswordMapper stuPasswordMapper;


    /**
     * 修改学生登录密码
     * @param stuPasswordDto
     */
    public void StuPasswordAlter(StuPasswordDto stuPasswordDto) {
        //根据学号查询旧密码
        Integer e = stuPasswordMapper.StuPasswordSelect(stuPasswordDto);
        if(e != null && stuPasswordDto.getNewPassword() != null){
            //修改密码
            stuPasswordMapper.StuPasswordAlter(stuPasswordDto);
        }else{
            System.out.println("查询失败，账号或密码错误");
        }

    }
}
